package com.maila.xiaoaobusiness.activity;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.ListView;
import android.widget.RadioButton;

import com.cjj.MaterialRefreshLayout;
import com.maila.xiaoaobusiness.R;
import com.maila.xiaoaobusiness.utils.StartActivityUtils;
import com.zhy.autolayout.AutoLinearLayout;
import com.zhy.autolayout.AutoRelativeLayout;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * 活动管理
 * Created by Mark on 2017/11/23.
 */

public class PromotionActivity extends AppCompatActivity {
    @BindView(R.id.white_return_iv)
    AutoRelativeLayout whiteReturnIv;
    @BindView(R.id.rb_hall)
    RadioButton rbHall;
    @BindView(R.id.rb_myorder)
    RadioButton rbMyorder;
    @BindView(R.id.rl_title)
    AutoRelativeLayout rlTitle;
    @BindView(R.id.lv_fujin)
    ListView lvFujin;
    @BindView(R.id.hot_refresh)
    MaterialRefreshLayout hotRefresh;
    @BindView(R.id.ll_add_new)
    AutoLinearLayout llAddNew;

    int type=0;
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_promotion);
        ButterKnife.bind(this);
    }

   void setRbStatus(){
        if(type==0){
            rbHall.setChecked(true);
            rbMyorder.setChecked(false);
            llAddNew.setVisibility(View.VISIBLE);
            hotRefresh.setVisibility(View.GONE);
        }else {
            rbMyorder.setChecked(true);
            rbHall.setChecked(false);
            llAddNew.setVisibility(View.GONE);
            hotRefresh.setVisibility(View.VISIBLE);
        }
    }

    @OnClick({R.id.white_return_iv, R.id.rb_hall, R.id.rb_myorder,R.id.add_manjian, R.id.add_shoudan, R.id.add_tejia, R.id.add_discount, R.id.add_fanquan})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.white_return_iv:
                finish();
                break;
            case R.id.rb_hall:
                type=0;
                setRbStatus();
                break;
            case R.id.rb_myorder:
                type=1;
                setRbStatus();
                break;
            case R.id.add_manjian:
                StartActivityUtils.start(this,MoneyOffActivity.class);
                break;
            case R.id.add_shoudan:
                StartActivityUtils.start(this,FirstSaleActivity.class);
                break;
            case R.id.add_tejia:
                StartActivityUtils.start(this,TodaySaleActivity.class);
                break;
            case R.id.add_discount:
                StartActivityUtils.start(this,NewDisscountActivity.class);
                break;
            case R.id.add_fanquan:
                StartActivityUtils.start(this,GiveCouponsActivity.class);
                break;
        }
    }

}
